#include "Thread.hpp"
// #include "ThreadPool_v1.hpp"
// #include "ThreadPool_v2.hpp"
// #include "ThreadPool_v3.hpp"
#include "ThreadPool_v4.hpp"
#include "Task.hpp"
#include <memory>
using std::cin;
using std::cout;
using std::endl;

int main()
{
    // std::unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>(20));

    // tp->init();
    // tp->start();
    // tp->check();

    // printf("0x%x\n", ThreadPool<Task>::getInstance());
    // printf("0x%x\n", ThreadPool<Task>::getInstance());
    // printf("0x%x\n", ThreadPool<Task>::getInstance());
    // printf("0x%x\n", ThreadPool<Task>::getInstance());
    // printf("0x%x\n", ThreadPool<Task>::getInstance());
    

    while (true)
    {
        // 充当生产者
        int x, y;
        char op;

        cout << "input x:";
        cin >> x;
        cout << "input y:";
        cin >> y;
        cout << "input op:";
        cin >> op;
        cout << endl;
        Task t(x, y, op);
        ThreadPool<Task>::getInstance()->pushTask(t);
        // tp->pushTask(t);
        sleep(1);
    }

    return 0;
}